<template>
<div class="main">
    <my-header class="header-main">
      <login-bar></login-bar>
    </my-header>
  <div class="fee h980">
    <div
      class="title font-18 font-bit-bold color-fff"
      v-text="$t('label413')||'Startup我的参与记录'"
    ></div>
    <div class="form mining" >
        <div class="panel-container">
          <el-tabs type="border-card" v-model="activeName" @tab-click="handleClick" class="tab15">
            <el-tab-pane label="参与记录" name="1">
            <template v-if="userData.isLogin">
            <el-table
              :data='lockInfoData'
              :default-sort="{prop: 'wdate', order: 'descending'}"
            >
              <el-table-column
                type="index"
                width="50">
              </el-table-column>
              <el-table-column
                width="150"
                prop='number'
                :label='$t("label414")'
              >
                <template slot-scope="scope">
                  <span> {{Number(scope.row.mainnumber)||'0'}} </span>
                </template>
              </el-table-column>
							<el-table-column :label="$t('label415')||'项目名称'"  min-width="150">
                <template slot-scope="scope">
                  <span> {{scope.row.name}} </span>
                </template>
              </el-table-column>
              <el-table-column :label="$t('time')||'时间'" min-width="150">
                <template slot-scope="scope">
                  <span> {{scope.row.wdate||'0'}} </span>
                </template>
              </el-table-column>
							<el-table-column :label="$t('label416')||'参与币种'" min-width="150">
                <template slot-scope="scope">
                  <span> {{scope.row.maincoin||'--'}} </span>
                </template>
              </el-table-column>
              <el-table-column :label="$t('label417')||'获得数量'"  min-width="150">
                <template slot-scope="scope">
                  <span> {{Number(scope.row.iconumber)||'0'}} </span>
                </template>
              </el-table-column>
							<!-- <el-table-column :label="$t('label418')||'项目编号'"  min-width="150">
                <template slot-scope="scope">
                  <span> {{scope.row.projectid||'0'}} </span>
                </template>
              </el-table-column> -->
							<el-table-column :label="$t('label419')||'私募币种'"  min-width="150">
                <template slot-scope="scope">
                  <span> {{scope.row.icocoin||'0'}} </span>
                </template>
              </el-table-column>
              <el-table-column :label='$t("status")'  min-width="150">
                <template slot-scope="scope">
                  <span v-text="scope.row.state=='0'?($t('label420')||'待发币'):($t('label421')||'已发币')"
                    :class="scope.row.state=='0'?'color-danger':'color-success'"
                  ></span>
                </template>
              </el-table-column>
            </el-table>
          </template>
            </el-tab-pane>
          </el-tabs>

          <unlogin-tip></unlogin-tip>
        </div>
      </div>
  </div>
  <my-footer></my-footer>
  </div>
</template>
<script>
export default {
  data() {
    return {
      banner: require("@/assets/images/shangbi/cb_bg.png"),
      formData: null,
      userData: this.userModel,
      activeName: '1',
      lockInfoData:[],
      lockDayInfo:[],
    };
  },
  mounted() {
    // 币种费率
    this.geticobill();
  },
  methods: {
    handleClick(tab, event) {
      //选项卡数据切换
        console.log(tab, event);
        console.log(event.target.getAttribute('id'))  //获取到当前元素的id
        const id=event.target.getAttribute('id');
        this.Tabid=event.target.getAttribute('id');
      if(id=='tab-1'){
        this.lockInfoData=[];
        this.geticobill();
      } else if(id=='tab-2'){
        this.lockDayInfo=[];
        this.getlockincomebill();
      }
    },
    getFee() {
      this.request(this.api.gaslist).then(res => {
        console.log(`费率：${JSON.stringify(res)}`);
        if (res && res.code != "0") return this.getDataFaild(res.msg);
        res.data  && (this.formData = res.data);
      });
    },
    // 获取锁仓记录 act=0
    geticobill() {
      // 判断是否登录 请求数据
        if (this.userData.isLogin) {
          this.request(this.api.geticobill).then(res => {
            if (res.code == "0") {
              this.lockInfoData = res.data || "";
              this.infocoin=res.data.result[0].coin ||'';
            } else {
              this.errMsg(res.msg || "操作失败");
            }
          });
        }
      
    },
    // 收益记录 act=1
    getlockincomebill() {
      this.request(this.api.getlockincomebill).then(res => {
        if (res.code == "0") {
          this.lockDayInfo = res.data.result || "";
        } else {
          this.errMsg(res.msg || "操作失败");
        }
      });
    },
  }
};
</script>

<style lang="scss" scoped>
.fee {
  width: 77%;
  margin: 0 auto;
  padding: 30px 0 40px 0;
}
.el-table {
  color: $main-font-color;
}
.table-wrap {
  border: $default-border;
  border-bottom: none;
  margin-top: 25px;
  img {
    display: inline-block;
    margin-right: 5px;
  }
}
.h980{min-height: 900px;}
.tab15{margin-top: 15px;}
</style>
